package com.trade.service.impl;

import java.util.List;

import com.trade.common.util.PaginationSupport;
import com.trade.dao.IGoodsDao;
import com.trade.model.Goods;
import com.trade.service.IGoodsService;

/**
 * 
 * 商品的业务实现类
 *
 * @author	chengpeng.zhang
 * @version           1.0
 * @since             2012-11-16
 */
public class GoodsServiceImpl implements IGoodsService {
	private IGoodsDao goodsDao;
	
	public IGoodsDao getGoodsDao() {
		return goodsDao;
	}

	public void setGoodsDao(IGoodsDao goodsDao) {
		this.goodsDao = goodsDao;
	}

	/* (non-Jsdoc)
	 * @author Administrator
	 * @see com.trade.service.IGoodsService#save(com.trade.model.Goods)
	 */
	@Override
	public void save(Goods goods) {
		this.goodsDao.saveOrUpdate(goods);
	}

	/* (non-Jsdoc)
	 * @author Administrator
	 * @see com.trade.service.IGoodsService#getGoods(long)
	 */
	@Override
	public Goods getGoods(long goodsId) {
		return this.goodsDao.load(goodsId);
	}

	/* (non-Jsdoc)
	 * @author Administrator
	 * @see com.trade.service.IGoodsService#getGoodsList(com.trade.common.util.PaginationSupport)
	 */
	@Override
	public PaginationSupport getGoodsList(PaginationSupport page) {
		return this.goodsDao.getGoodsList(page);
	}

	/* (non-Jsdoc)
	 * @author Administrator
	 * @see com.trade.service.IGoodsService#getAllGoods()
	 */
	@Override
	public List<Goods> getAllGoods() {
		return goodsDao.list();
	}
	
}
